/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.ove.openmath.exceptions;

/**
 *
 * @author Mr.Sam
 */
public abstract class ErrorMessageException extends RuntimeException {
    /**
    * The error symbol which cause this exception
    */
    private String symbol;
    
    /**
    * The error message
    */
    private String errorMessage;
    
    /** 
    * The details to send with the message
    */
    private Object details;
    
    /**
    * Do we have to throw the exception again ?
    */
    private boolean throwAgain = false;

    /**
    * The constructor.
    * @param symbol The symbol which throws the instance.
    */
    public ErrorMessageException(String symbol) {
        this(symbol, null);
    }

    /**
    * The constructor.
    * @param symbol The symbol which throws the instance.
    * @param details the details of the exception
    */
    public ErrorMessageException(String symbol, Object details) {
        this.symbol = symbol;
        this.details = details;
    }
    
    /**
    * Returns the symbols which throws the instance
    */
    public String getSymbol() {
        return symbol;
    }
    
    /**
    * Sets the symbol which throws the instance
    */
    public void setSymbol(String symbol) {
        this.symbol = symbol;
    }

    /**
    * Returns the details of the exception
    */
    public Object getDetails() {
        return details;
    }
    
    /**
    * Sets the details of the exception
    */ 
    public void setDetails(Object details) {
        this.details = details;
    }
    
    /**
    * Sets <CODE>true</CODE> if we've got to throw the exception.<BR>
    * <CODE>false</CODE> otherwise.
    */
    public void setThrowAgain(boolean throwAgain) {
        this.throwAgain = throwAgain;
    }
    
    /**
    * Returns if we've got to throw the exception.
    */
    public boolean getThrowAgain() {
        return throwAgain;
    }
    
    /**
    * Sets the error message
    */
    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }
    
    /**
    * Returns the error message
    */
    public String getErrorMessage() {
        return errorMessage;
    }
}